home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / necko / nsICachingChannel.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  10KB  |  258 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsICachingChannel.idl
  3.  */
  4.  
  5. #ifndef __gen_nsICachingChannel_h__
  6. #define __gen_nsICachingChannel_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIFile; /* forward declaration */
  18.  
  19.  
  20. /* starting interface:    nsICachingChannel */
  21. #define NS_ICACHINGCHANNEL_IID_STR "b1f95f5e-ee05-4434-9d34-89a935d7feef"
  22.  
  23. #define NS_ICACHINGCHANNEL_IID \
  24.   {0xb1f95f5e, 0xee05, 0x4434, \
  25.     { 0x9d, 0x34, 0x89, 0xa9, 0x35, 0xd7, 0xfe, 0xef }}
  26.  
  27. /**
  28.  * A channel may optionally implement this interface to allow clients
  29.  * to affect its behavior with respect to how it uses the cache service.
  30.  *
  31.  * This interface provides:
  32.  *   1) Support for "stream as file" semantics (for JAR and plugins).
  33.  *   2) Support for "pinning" cached data in the cache (for printing and save-as).
  34.  *   3) Support for uniquely identifying cached data in cases when the URL
  35.  *      is insufficient (e.g., HTTP form submission).
  36.  */
  37. class NS_NO_VTABLE nsICachingChannel : public nsISupports {
  38.  public: 
  39.  
  40.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICACHINGCHANNEL_IID)
  41.  
  42.   /**
  43.      * Set/get the cache token... uniquely identifies the data in the cache.
  44.      * Holding a reference to this token prevents the cached data from being
  45.      * removed.
  46.      * 
  47.      * A cache token retrieved from a particular instance of nsICachingChannel
  48.      * could be set on another instance of nsICachingChannel provided the
  49.      * underlying implementations are compatible.  The implementation of
  50.      * nsICachingChannel would be expected to only read from the cache entry
  51.      * identified by the cache token and not try to validate it.
  52.      *
  53.      * The cache token can be QI'd to a nsICacheEntryInfo if more detail
  54.      * about the cache entry is needed (e.g., expiration time).
  55.      */
  56.   /* attribute nsISupports cacheToken; */
  57.   NS_IMETHOD GetCacheToken(nsISupports * *aCacheToken) = 0;
  58.   NS_IMETHOD SetCacheToken(nsISupports * aCacheToken) = 0;
  59.  
  60.   /**
  61.      * Set/get the cache key... uniquely identifies the data in the cache
  62.      * for this channel.  Holding a reference to this key does NOT prevent
  63.      * the cached data from being removed.
  64.      * 
  65.      * A cache key retrieved from a particular instance of nsICachingChannel
  66.      * could be set on another instance of nsICachingChannel provided the
  67.      * underlying implementations are compatible and provided the new 
  68.      * channel instance was created with the same URI.  The implementation of
  69.      * nsICachingChannel would be expected to use the cache entry identified
  70.      * by the cache token.  Depending on the value of nsIRequest::loadFlags,
  71.      * the cache entry may be validated, overwritten, or simply read.
  72.      *
  73.      * The cache key may be NULL indicating that the URI of the channel is
  74.      * sufficient to locate the same cache entry.  Setting a NULL cache key
  75.      * is likewise valid.
  76.      */
  77.   /* attribute nsISupports cacheKey; */
  78.   NS_IMETHOD GetCacheKey(nsISupports * *aCacheKey) = 0;
  79.   NS_IMETHOD SetCacheKey(nsISupports * aCacheKey) = 0;
  80.  
  81.   /**
  82.      * Specifies whether or not the data should be cached to a file.  This
  83.      * may fail if the disk cache is not present.  The value of this attribute
  84.      * is usually only settable during the processing of a channel's
  85.      * OnStartRequest.  The default value of this attribute depends on the
  86.      * particular implementation of nsICachingChannel.
  87.      */
  88.   /* attribute boolean cacheAsFile; */
  89.   NS_IMETHOD GetCacheAsFile(PRBool *aCacheAsFile) = 0;
  90.   NS_IMETHOD SetCacheAsFile(PRBool aCacheAsFile) = 0;
  91.  
  92.   /**
  93.      * Get the "file" where the cached data can be found.  This is valid for
  94.      * as long as a reference to the cache token is held.  This may return
  95.      * an error if cacheAsFile is false.
  96.      */
  97.   /* readonly attribute nsIFile cacheFile; */
  98.   NS_IMETHOD GetCacheFile(nsIFile * *aCacheFile) = 0;
  99.  
  100.   /**
  101.      * TRUE if this channel's data is being loaded from the cache.  This value
  102.      * is undefined before the channel fires its OnStartRequest notification
  103.      * and after the channel fires its OnStopRequest notification.
  104.      */
  105.   /* boolean isFromCache (); */
  106.   NS_IMETHOD IsFromCache(PRBool *_retval) = 0;
  107.  
  108.   /**************************************************************************
  109.      * Caching channel specific load flags:
  110.      */
  111. /**
  112.      * This load flag causes the local cache to be skipped when fetching a
  113.      * request.  Unlike LOAD_BYPASS_CACHE, it does not force an end-to-end load
  114.      * (i.e., it does not affect proxy caches).
  115.      */
  116.   enum { LOAD_BYPASS_LOCAL_CACHE = 268435456U };
  117.  
  118.   /**
  119.      * This load flag causes the local cache to be skipped if the request
  120.      * would otherwise block waiting to access the cache.
  121.      */
  122.   enum { LOAD_BYPASS_LOCAL_CACHE_IF_BUSY = 536870912U };
  123.  
  124.   /**
  125.      * This load flag inhibits fetching from the net if the data in the cache
  126.      * has been evicted.  An error of NS_ERROR_DOCUMENT_NOT_CACHED will be sent
  127.      * to the listener's onStopRequest in this case.
  128.      */
  129.   enum { LOAD_ONLY_FROM_CACHE = 1073741824U };
  130.  
  131.   /**
  132.      * This load flag controls what happens when a document would be loaded
  133.      * from the cache to satisfy a call to AsyncOpen.  If this attribute is
  134.      * set to TRUE, then the document will not be loaded from the cache.  A
  135.      * stream listener can check nsICachingChannel::isFromCache to determine
  136.      * if the AsyncOpen will actually result in data being streamed.
  137.      *
  138.      * If this flag has been set, and the request can be satisfied via the
  139.      * cache, then the OnDataAvailable events will be skipped.  The listener
  140.      * will only see OnStartRequest followed by OnStopRequest.
  141.      */
  142.   enum { LOAD_ONLY_IF_MODIFIED = 2147483648U };
  143.  
  144. };
  145.  
  146. /* Use this macro when declaring classes that implement this interface. */
  147. #define NS_DECL_NSICACHINGCHANNEL \
  148.   NS_IMETHOD GetCacheToken(nsISupports * *aCacheToken); \
  149.   NS_IMETHOD SetCacheToken(nsISupports * aCacheToken); \
  150.   NS_IMETHOD GetCacheKey(nsISupports * *aCacheKey); \
  151.   NS_IMETHOD SetCacheKey(nsISupports * aCacheKey); \
  152.   NS_IMETHOD GetCacheAsFile(PRBool *aCacheAsFile); \
  153.   NS_IMETHOD SetCacheAsFile(PRBool aCacheAsFile); \
  154.   NS_IMETHOD GetCacheFile(nsIFile * *aCacheFile); \
  155.   NS_IMETHOD IsFromCache(PRBool *_retval); \
  156.  
  157. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  158. #define NS_FORWARD_NSICACHINGCHANNEL(_to) \
  159.   NS_IMETHOD GetCacheToken(nsISupports * *aCacheToken) { return _to GetCacheToken(aCacheToken); } \
  160.   NS_IMETHOD SetCacheToken(nsISupports * aCacheToken) { return _to SetCacheToken(aCacheToken); } \
  161.   NS_IMETHOD GetCacheKey(nsISupports * *aCacheKey) { return _to GetCacheKey(aCacheKey); } \
  162.   NS_IMETHOD SetCacheKey(nsISupports * aCacheKey) { return _to SetCacheKey(aCacheKey); } \
  163.   NS_IMETHOD GetCacheAsFile(PRBool *aCacheAsFile) { return _to GetCacheAsFile(aCacheAsFile); } \
  164.   NS_IMETHOD SetCacheAsFile(PRBool aCacheAsFile) { return _to SetCacheAsFile(aCacheAsFile); } \
  165.   NS_IMETHOD GetCacheFile(nsIFile * *aCacheFile) { return _to GetCacheFile(aCacheFile); } \
  166.   NS_IMETHOD IsFromCache(PRBool *_retval) { return _to IsFromCache(_retval); } \
  167.  
  168. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  169. #define NS_FORWARD_SAFE_NSICACHINGCHANNEL(_to) \
  170.   NS_IMETHOD GetCacheToken(nsISupports * *aCacheToken) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCacheToken(aCacheToken); } \
  171.   NS_IMETHOD SetCacheToken(nsISupports * aCacheToken) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCacheToken(aCacheToken); } \
  172.   NS_IMETHOD GetCacheKey(nsISupports * *aCacheKey) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCacheKey(aCacheKey); } \
  173.   NS_IMETHOD SetCacheKey(nsISupports * aCacheKey) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCacheKey(aCacheKey); } \
  174.   NS_IMETHOD GetCacheAsFile(PRBool *aCacheAsFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCacheAsFile(aCacheAsFile); } \
  175.   NS_IMETHOD SetCacheAsFile(PRBool aCacheAsFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCacheAsFile(aCacheAsFile); } \
  176.   NS_IMETHOD GetCacheFile(nsIFile * *aCacheFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCacheFile(aCacheFile); } \
  177.   NS_IMETHOD IsFromCache(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsFromCache(_retval); } \
  178.  
  179. #if 0
  180. /* Use the code below as a template for the implementation class for this interface. */
  181.  
  182. /* Header file */
  183. class nsCachingChannel : public nsICachingChannel
  184. {
  185. public:
  186.   NS_DECL_ISUPPORTS
  187.   NS_DECL_NSICACHINGCHANNEL
  188.  
  189.   nsCachingChannel();
  190.  
  191. private:
  192.   ~nsCachingChannel();
  193.  
  194. protected:
  195.   /* additional members */
  196. };
  197.  
  198. /* Implementation file */
  199. NS_IMPL_ISUPPORTS1(nsCachingChannel, nsICachingChannel)
  200.  
  201. nsCachingChannel::nsCachingChannel()
  202. {
  203.   /* member initializers and constructor code */
  204. }
  205.  
  206. nsCachingChannel::~nsCachingChannel()
  207. {
  208.   /* destructor code */
  209. }
  210.  
  211. /* attribute nsISupports cacheToken; */
  212. NS_IMETHODIMP nsCachingChannel::GetCacheToken(nsISupports * *aCacheToken)
  213. {
  214.     return NS_ERROR_NOT_IMPLEMENTED;
  215. }
  216. NS_IMETHODIMP nsCachingChannel::SetCacheToken(nsISupports * aCacheToken)
  217. {
  218.     return NS_ERROR_NOT_IMPLEMENTED;
  219. }
  220.  
  221. /* attribute nsISupports cacheKey; */
  222. NS_IMETHODIMP nsCachingChannel::GetCacheKey(nsISupports * *aCacheKey)
  223. {
  224.     return NS_ERROR_NOT_IMPLEMENTED;
  225. }
  226. NS_IMETHODIMP nsCachingChannel::SetCacheKey(nsISupports * aCacheKey)
  227. {
  228.     return NS_ERROR_NOT_IMPLEMENTED;
  229. }
  230.  
  231. /* attribute boolean cacheAsFile; */
  232. NS_IMETHODIMP nsCachingChannel::GetCacheAsFile(PRBool *aCacheAsFile)
  233. {
  234.     return NS_ERROR_NOT_IMPLEMENTED;
  235. }
  236. NS_IMETHODIMP nsCachingChannel::SetCacheAsFile(PRBool aCacheAsFile)
  237. {
  238.     return NS_ERROR_NOT_IMPLEMENTED;
  239. }
  240.  
  241. /* readonly attribute nsIFile cacheFile; */
  242. NS_IMETHODIMP nsCachingChannel::GetCacheFile(nsIFile * *aCacheFile)
  243. {
  244.     return NS_ERROR_NOT_IMPLEMENTED;
  245. }
  246.  
  247. /* boolean isFromCache (); */
  248. NS_IMETHODIMP nsCachingChannel::IsFromCache(PRBool *_retval)
  249. {
  250.     return NS_ERROR_NOT_IMPLEMENTED;
  251. }
  252.  
  253. /* End of implementation class template. */
  254. #endif
  255.  
  256.  
  257. #endif /* __gen_nsICachingChannel_h__ */
  258.